<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<title>Resource Selection-<%#actionname%>
		-<%#propertyname%></title>
	<STYLE><%#stylesheet%>
	</STYLE>
	<body marginheight="0" marginwidth="0" topmargin="0" onload="init();">
		<form method="post" ID="Form1">
			<TABLE width="100%" height="137" bgcolor="<%#bgcolor%>" cellspacing="0" cellpadding="0" ID="Table2">
				<tr>
					<td height="81">Set attachments save options. <br>
						<table border="0" ID="Table1" width="457" height="48">
							<tr>
								<td width="24" height="19">
									&nbsp;</td>
								<td width="121" height="19">
									&nbsp;</td>
								<td width="76" height="19">
									Pattern:</td>
								<td width="6" height="19">
									&nbsp;</td>
								<td width="6" height="19">
									&nbsp;</td>
								<td vAlign="center" align="middle" width="200" height="19">
									&nbsp;</td>
							</tr>
							<tr>
								<td width="24" height="21">
									&nbsp;</td>
								<td width="121" height="21">
									&nbsp;<SELECT id="Select1" name="Select1" onchange="return Select1_onchange();">										
										<%#assignOption%>
										<!--<OPTION value="All Files,AllFiles">All 
                                        Files</OPTION>
										<OPTION value="File Name,FileName">File 
                                        Name</OPTION>
										<OPTION value="File Content,FileContent">
                                        File Content</OPTION>-->
									</SELECT></td>
								<td width="76" height="21">
									<SELECT id="Select3" name="Select3" language="javascript" onchange="return Select3_onclick();">
										<%#assignPatternFrom%>
										<!--<OPTION value="Value" selected>Value</OPTION>
										<OPTION value="Variable">Variable</OPTION>
										<OPTION value="Content">Content</OPTION>
										<OPTION value=""></OPTION>-->
									</SELECT>
								</td>
								<td width="6" height="21">
									<div id="expr2">&nbsp;</div>
								</td>
								<td width="6" height="21">
									&nbsp;</td>
								<td vAlign="center" align="middle" width="200" height="21">
									&nbsp;
								</td>
							</tr>
						</table>
					</td>
				</tr>
<!--					<TD align="right" height="40">
						<INPUT id="Button2" class="buttons" type="button" value="Clear" name="Button2" language="javascript" onclick="return Button2_onclick()">
						<INPUT id="button3" class="buttons" type="button" value="Update" name="button3" onclick="return submitform();">
	-->				</TD>

				<TR>
					<TD height="4" bgcolor="black"><IMG src="?drawimage=spacer.gif" height="1"></TD>
				</TR>
				<tr>
					<TD align="right" height="40">
						&nbsp;<INPUT id="button3" class="buttons" type="button" value="Update" name="button3" onclick="return submitform();">
						<INPUT id="Button2" class="buttons" type="button" value="Close" name="Button2" language="javascript" onclick="return Button2_onclick()">
					</TD>
				</tr>
			</TABLE>
		</form>
		<script language="javascript">
		var i=0;
		var oexprstr;
		var sExpression="<%#sExpression%>";
		var sDispExpression="<%#sDispExpression%>";
		var iOpenBrackets=0;


		var valuediv = "<input id='valueinput' type='text' value='"+"<%#assignSearchPattern%>"+"'>";
		var variablediv = "<SELECT id='valueinput'>";
		variablediv += "<%#assignvariables%>";
		variablediv +=	"</SELECT>";

		var contentdiv = "<SELECT id='valueinput'>";
		contentdiv += "<%#assigncontent%>";
		contentdiv +=	"</SELECT>";

		var oexpr2;

		oexpr2 = document.getElementsByTagName("div")["expr2"];

		function changeDiv( divvar )
		{
			if( !oexpr2 )
				oexpr2 = document.getElementsByTagName("div")["expr2"];

			oexpr2.innerHTML = eval(divvar);
		}

		function Select3_onclick()
		{
			var oselect3 = document.getElementsByTagName("select")["Select3"];

			switch(oselect3.value)
			{
				case "Value": changeDiv("valuediv");
							break;
				case "Variable": changeDiv("variablediv");
								break;

				case "Content": changeDiv("contentdiv");
								break;
			}

			return false;
		}

		function init()
		{
			Select3_onclick();			
			Select1_onchange();						
			//document.getElementsByTagName("input")["button3"].disabled=true; //Submit button initially disabled						
		}

		function Select1_onchange()
		{
			var oselect1 = document.getElementsByTagName("select")["Select1"];
			var odiv = document.getElementsByTagName("div")["otherinputs"];
			var o = document.getElementsByTagName("*")["valueinput"];

			//var values = oselect1.value.split(",");

			//switch(values[1])
			switch(oselect1.value)
			{
				case "AllFiles":  //document.getElementsByTagName("select")["Select2"].disabled=false;
						document.getElementsByTagName("select")["Select3"].disabled=true;
   						//document.getElementsByTagName("select")["Select5"].disabled=false;
						if( o )  o.disabled=true;
 						break;
				default:   //document.getElementsByTagName("select")["Select2"].disabled=true;
						document.getElementsByTagName("select")["Select3"].disabled=false;
						//document.getElementsByTagName("select")["Select5"].disabled=true;
						if( o) o.disabled=false;
						break;
			}

		}


		function Button2_onclick()
		{						
			window.close();

		}
		
		function ConvertToString(  number,  width )
		{
			var str="";
			var i;

			str=number.toString();
			var l = str.length;
			for(i=0;i<(width-l);i++)
			{
				str = "0" + str;
			}
			return str.substring(0,width);
		}
		
		function submitform()
		{

			//submitvalue = document.getElementsByTagName("input")["propertyvalue"].value;
			 				
			var sSaveOption=document.getElementsByTagName("select")["Select1"].value;				
			
			var sSearchPattern=document.getElementsByTagName("*")["valueinput"].value;
			var sSearchType=document.getElementsByTagName("select")["Select3"].value;			
			if(typeof(((sSaveOption.split(","))[1])) != 'undefined')
			{
				var Names =	sSaveOption.split(",");
				sSaveOption=Names[1];
			}
			if (sSearchType!="Value")
			{
				if(typeof(((sSearchPattern.split(","))[1])) != 'undefined')
				{
					var sPattern =	sSearchPattern.split(",");
					sSearchPattern=sPattern[1];
				}
				
			}
			submitvalue = ConvertToString( sSaveOption.length, 4 ) + sSaveOption+ ConvertToString( sSearchPattern.length, 4) + sSearchPattern;
			submitvalue = submitvalue + ConvertToString( sSearchType.length, 4 ) + sSearchType;
			window.opener.properties("_hidtempstore",submitvalue);
			window.opener.submitform("?mode=edit&<%#qspropertypagename%>=<%#propertypage%>&<%#qspropertyname%>=<%#propertyname%>&<%#SelectedItemQueryString%>");
			window.close();
		}
		</script>
	</body>
</html>